package com.fanco.learn_datastruct_leetcode.reflection.proxy_jdk;

import java.lang.reflect.Proxy;

public class TestProxy {
    public static void main(String[] args) {
        SomeService service = new SomeServiceImpl();
        SomeInvocationHandler someInvocationHandler = new SomeInvocationHandler(service);
        SomeService proxy = (SomeService) Proxy.newProxyInstance(someInvocationHandler.getClass().getClassLoader(),
                service.getClass().getInterfaces(), someInvocationHandler);
        proxy.eat("你好");

    }
}
